# RT-Thread building script for bridge

import rtconfig
Import('RTT_ROOT')
from building import *

# get current directory
cwd = GetCurrentDir()

# The set of source files associated with this SConscript file.
src = Split("""
CMSIS/DeviceSupport/HDSC/HC32F46x/Source/system_hc32f46x.c
""")

src += Glob('HC32F46x_StdPeriph_Driver/src/*.c')


#add for startup script 
if rtconfig.CROSS_TOOL == 'gcc':
     src = src + ['CMSIS/DeviceSupport/HDSC/HC32F46x/Source/GCC/startup_hc32f46x.s']
elif rtconfig.CROSS_TOOL == 'keil':
     src = src + ['CMSIS/DeviceSupport/HDSC/HC32F46x/Source/ARM/startup_hc32f46x.s']
elif rtconfig.CROSS_TOOL == 'iar':
     src = src + ['CMSIS/DeviceSupport/HDSC/HC32F46x/Source/IAR/startup_hc32f46x.s']

#add headfile script 
path = [cwd + '/CMSIS/CoreSupport/Include', 
    cwd + '/CMSIS/DeviceSupport/HDSC/HC32F46x/Include',
    cwd + '/HC32F46x_StdPeriph_Driver/inc']

CPPDEFINES = ['USE_DEVICE_DRIVER_LIB', rtconfig.MCU_TYPE, '__DEBUG']

group = DefineGroup('HC32_StdPeriph', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)

Return('group')
